package com.dmgis.qxfw.utils;

import java.util.Random;

public class AchieveRandom {

	public String getFileName(String collectionName){
		String suffix = "";
		if(collectionName.contains("png")){
			suffix = ".png";
		}else if(collectionName.contains("jpg")){
			suffix = ".jpg";
		}else if(collectionName.contains("doc")){
			suffix = ".doc";
		}else if(collectionName.contains("docx")){
			suffix = ".docx";
		}else if(collectionName.contains("excel")){
			suffix = ".xls";
		}else if(collectionName.contains("bmp")){
			suffix = ".bmp";
		}else{
			suffix = ".txt";
		}
		DateTime dt = DateTime.now();
		String name = dt.toDateTimeString().replace(" ", "_");
		Random r = new Random();
		int i = r.nextInt(100);
		String fileName = name + i + suffix;
		return fileName;
	}
}
